package org.java.net.socket;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class IpAddress1 {
	
	public static void main(String[] args)
	{
		InetAddress ip = null;
		
		try
		{
			ip = InetAddress.getByName("127.0.0.1");
			System.out.println("主机名" + ip.getHostName());
			System.out.println("主机IP地址" + ip.getHostAddress());
			System.out.println("本机IP地址" + InetAddress.getLocalHost().getHostAddress());
		}
		catch(UnknownHostException ue)
		{
			System.out.println(ue);
		}
	}

}
